package com.interpreter.iface.extend;

import com.interpreter.iface.Expression;

import java.util.Arrays;
import java.util.List;

public class OrExpression implements Expression {

    private List<Expression> expressionList;

    public OrExpression(Expression ... expressions) {
        this.expressionList = Arrays.asList(expressions);
    }

    @Override
    public boolean interpret(String context) {
        boolean result = false;
        for ( Expression exp : expressionList )
            result = result || exp.interpret(context);
        return result;
    }
}
